

<template>
  <div class="leftSearch">
    <div class="search">
      <el-input
        v-model="leftParams.keyword"
        placeholder="请输入姓名/门诊号/身份证号"
      ></el-input>
      <el-button type="success" class="butB_Sel" @click="searchB()"
        >查询</el-button
      >
    </div>
    <div class="search">
      <el-date-picker
        v-model="leftParams.initStart_time"
        type="daterange"
        range-separator="-"
        @change="riqiSel"
        value-format="yyyy-MM-dd"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
      >
      </el-date-picker>
    </div>
    <div class="leftRadio">
      <el-radio-group @change="searchB" v-model="leftParams.leftRadio">
        <el-radio :label="1">个人</el-radio>
        <el-radio :label="2">科室</el-radio>
        <el-radio :label="3">全院</el-radio>
      </el-radio-group>
    </div>

    <div class="tableB">
      <el-table
        v-loading="loading"
        :data="tableData"
        @current-change="setPatientInfo"
        @row-click="setrow"
        @row-dblclick="db_jiaohao"
        highlight-current-row
      >
        <el-table-column type="index" label="序号" width="50">
        </el-table-column>
        <template v-for="(item, index) in tableTitle">
          <el-table-column
            :width="item.width"
            v-if="item.prop == 'status'"
            :prop="item.prop"
            :label="item.label"
            :key="index"
          >
            <template slot-scope="scope">
              <span class="on" v-if="scope.row.status == 1">待叫</span>
              <span class="on" v-if="scope.row.status == 2">就诊中</span>
              <span class="on" v-if="scope.row.status == 3">已就诊 </span>
              <span class="on" v-if="scope.row.status == 4">过号 </span>
              <span class="on" v-if="scope.row.status == 5">已退号</span>
            </template>
          </el-table-column>
          <el-table-column
            v-else
            :prop="item.prop"
            :label="item.label"
            :key="index"
            :width="item.width"
          >
          </el-table-column>
        </template>
      </el-table>
    </div>

    <div>
      <el-dialog
        title="点击确定就诊此用户"
        v-if="dialogVisible"
        :visible.sync="dialogVisible"
        width="30%"
        :before-close="handleClose"
      >
        <div class="jiaohaoDialogSty">
          <div class="name">
            <span>门诊号：{{ jiaohaoData.patient_no }}</span>
            <span style="margin-left: 50px"
              >姓名：{{ jiaohaoData.member_info.name }}</span
            >
          </div>
          <div>卡号：{{ jiaohaoData.member_info.id_card }}</div>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="jiaohaoStatus">确 定</el-button>
        </span>
      </el-dialog>
    
    </div>
  </div>
</template>
<script>
let t;
export default {
  props: ["leftParams", "tableTitle", "tableData", "loading", "thatF"],

  data() {
    return {
      jiaohaoData: {},
      dialogVisible: false,
      params: {},
    };
  },
  mounted() {
    let t = this;
  },
  methods: {
    jiaohaoStatus() {
      // this.thatF.tabName = "second";
      // this.thatF.handleClick();
      // this.dialogVisible = false;
      // return;
      let d = {
        register_id: this.jiaohaoData.id,
        status: 1,
      };

      this["_API"].getClinic_doctorCall(d).then((res) => {
        if (res.code == 200) {
          this.thatF.tabName = "second";
          this.thatF.handleClick();
          this.dialogVisible = false;
        }
      });
    },
    searchB() {
      this.thatF.leftParams.page=1;
      this.thatF.getList("init");
    },
    subJiuZheng() {},
    handleClose() {
      this.dialogVisible = false;
    },
    db_jiaohao(e) {
      if (this.thatF.tabName == "first") {
        if (this.leftParams.leftRadio == 1) {
          this.dialogVisible = true;
          this.jiaohaoData = e;
        }
      }
    },
    setPatientInfo(item) {
      if (item) {
        if (this.thatF.tabName == "second") {
          this.thatF.PatientInfoData = item;
        } else if (this.thatF.tabName == "third") {
          this.thatF.order_tyte = "";
          this.thatF.PatientInfoDatathird = item;
          this.thatF.getClinic_doctorGetRecipe(item.patient_no);
        }
      }
    },
    riqiSel(e) {
      console.log("e", e);
      if (!e) {
        this.leftParams.start_time = "";
      } else {
        this.leftParams.start_time = this.leftParams.initStart_time
          .toString()
          .replace(",", "|")
          .toString();
      }

      this.leftParams.page = 1;
      this.thatF.getList("init");
    },
    setrow(row) {
      this.$emit("setrow", row);
    },
  },
  components: {},
};
</script>
<style lang='scss' scoped>
.leftSearch {
  > div {
    margin-bottom: 10px;
  }
  margin: 0 10px 10px;
  .search {
    display: flex;
    align-items: center;

    button {
      margin-left: 10px;
    }
  }
  .leftRadio {
    padding-left: 10px;
    /deep/ .el-radio__input.is-checked + .el-radio__label {
      color: #02bf6b;
    }
    /deep/ .el-radio__input.is-checked .el-radio__inner {
      border-color: #02bf6b;
      background: #02bf6b;
    }
  }
}
.tableB {
  /deep/ .el-table__empty-text {
    text-align: left;
    width: 100%;
    padding-left: 152px;
  }
}
.jiaohaoDialogSty {
  > div {
    line-height: 30px;
  }
  > .name {
    span {
      width: 100px;
    }
  }
}
</style>